home *** CD-ROM | disk | FTP | other *** search
/ Hot Metal Pro 4.0 / Hot Metal Pro 4.0.iso / Special / text / macros.txt < prev    next >
Encoding:
Text File  |  1997-11-17  |  7.6 KB  |  236 lines

  1.  
  2. 7. Using macros
  3.  
  4.  
  5.  
  6. A macro is a set of actions associated with a keyboard
  7. accelerator (also called a keyboard shortcut or hot
  8. key). The macro facility in the HoTMetaL PRO Editor
  9. can be used to define your own macros. This is particularly
  10. useful when you have to carry out some repetitive task
  11. that doesn't have a built-in accelerator or command.
  12.  
  13. You can save your macros in one or more files and load
  14. them as needed.
  15.  
  16.  Macros are not associated with a specific document,
  17. so any macros you load will be available for use with
  18. all documents that you edit.
  19.  
  20. Macros can be associated with text and/or elements to
  21. be inserted in a document, a single command, or a complex
  22. series of commands. Some actions that you can perform
  23. with macros are: 
  24.  
  25. * Insert an element that doesn't have a toolbar button
  26. associated with it.
  27.  
  28. * Set an attribute or property in several elements.
  29. For example, if you wanted to set the background color
  30. to `green' for several table cells that weren't in the
  31. same row or column, you could create a macro that set
  32. a cell's background to green, then navigate to each
  33. cell, re-running the macro each time. This would be
  34. faster than setting the background `manually' each time.
  35.  
  36. * Insert a piece of text that is used repeatedly.
  37.  
  38. * Create a keyboard shortcut for a command that doesn't
  39. have a built-in shortcut, subject to certainrestrictions.
  40.  
  41.  
  42. 7.1. Creating macros
  43.  
  44.  To record a macro:
  45.  
  46. * Choose  Record New Macro from the Tools menu or click
  47. on the {Run Macro} toolbar button. This starts macro
  48. recording. The command will then toggle to Stop Recording...
  49. and the status bar will read Recording macro.
  50.  
  51. * Enter the sequence of actions that you want the macro
  52. to carry out. These actions will not only be recorded,
  53. they will also be applied to the current document as
  54. you perform them. There are some restrictions on what
  55. can go into a macro.
  56.  
  57. * When you're finished, choose  Stop Recording... in
  58. the Tools menu or click on the {Stop Recording} toolbar
  59. button. This command ends the macro.
  60.  
  61. Now you will get a dialog box that lets you select a
  62. descriptive name and an accelerator for the macro. The
  63. accelerator is the sequence of keystrokes that will
  64. run the macro.  
  65.  
  66. An accelerator can consist of any choice from the Key
  67. list (a letter, number, function key, or arrow key),
  68. alone or preceded by [Ctrl], [Alt], or [ Shift] in any
  69. combination. 
  70.  
  71. * Enter a descriptive name for the macro.
  72.  
  73. * Choose the keys for the accelerator. 
  74.  
  75. * Click on [New Macro].
  76.  
  77. If you re-use one of HoTMetaL PRO's built-in keyboard
  78. accelerators as a macro accelerator, its original functionality
  79. will be unavailable as long as that macro is loaded.
  80.  
  81.  
  82. Restrictions on macros
  83.  
  84.  A macro should be self-contained, that is, its completion
  85. must not depend on any user input at the time the macro
  86. is run, such as typing in a dialog box or making a selection
  87. from a list. Therefore, there are some sequences of
  88. actions that cannot successfully be included in a macro.
  89. As a general guideline, if a macro involves any of the
  90. commands whose name ends in `...', that command should
  91. be completed somewhere in the macro. So, for example,
  92. you can define a macro that inserts a particular element,
  93. but you cannot define a macro that simply brings up
  94. the Insert Element dialog box.
  95.  
  96. Mouse clicks in the document window are ignored during
  97. macro recording. The first time you attempt to use the
  98. mouse to change the selection, HoTMetaL PRO will beep.
  99. The second time, you will get a message saying that
  100. you should use the cursor (arrow) keys to change the
  101. selection.
  102.  
  103. In general, a macro that was recorded in one of HoTMetaL
  104. PRO Editor's three views (WYSIWYG view, Tags On view,
  105. HTML Source view) should not be played back in the other
  106. two views.
  107.  
  108. The following other actions cannot be recorded in macro:
  109.  
  110. * Setting table properties.
  111.  
  112. *  The Check HTML and Check Accessibility commands.
  113.  
  114. *  Insertion of ActiveX controls and Design-Time Controls
  115. (DTCs).
  116.  
  117. * Spell checking operations.
  118.  
  119. If you use a toolbar button when recording a macro,
  120. note that even though a toolbar button can perform one
  121. of several actions (insert, change, split) only the
  122. action that was actually performed when you recorded
  123. the macro will be performed the next time you run the
  124. macro. For example, if the insertion point is inside
  125. a P element and you click on the {P} button, HoTMetaL
  126. PRO will split the P element. This action is recorded
  127. in a macro as `split the current element', so when the
  128. macro is run, it will attempt to split the current element,
  129. even if it's not a P. (By contrast, if you create markup
  130. with the Element... or  Change Element... command, it
  131. will be played back in the macro exactly as you entered
  132. it.)
  133.  
  134. 7.2. Running a macro
  135.  
  136. The usual way to run a macro is to type its keyboard
  137. accelerator. You can also run macros by choosing Macros...
  138. from the Tools menu. This gives you a dialog box that
  139. lists all the macros that are currently available. 
  140.  
  141. To run a macro: 
  142.  
  143. * Choose Macros... from the Tools menu, or click on
  144. the {Run Macro} toolbar button. The Macros dialog appears.
  145.  
  146. * Select the appropriate macro from the list.
  147.  
  148. * Click on [Run] .
  149.  
  150.  You can run only one macro at a time.
  151.  
  152. 7.3. Changing a macro accelerator
  153.  
  154. To change the accelerator associated with a macro:
  155.  
  156. * Choose Macros... from the Tools menu. The Macros dialog
  157. appears and displays a list of currently loaded macros.
  158.  
  159. * Select the macro that you want to change. 
  160.  
  161. * Choose a new accelerator using the Ctrl, Alt, and
  162. Shift check boxes and the Key list.
  163.  
  164. * Click on [Change].
  165.  
  166. 7.4. Deleting a macro
  167.  
  168. To delete a macro from the list of loaded macros: 
  169.  
  170. * Choose Macros... in the Tools menu. This displays
  171. a dialog box with a list of currently loaded macros.
  172.  
  173. * Select the macro that you want to delete. (You can
  174. delete only one macro at a time.)
  175.  
  176. * Click on [Delete].
  177.  
  178. If you delete a macro that has been loaded from a file,
  179. the macro is removed only from the list of available
  180. macros--it is not deleted from the file from which it
  181. was loaded, and can subsequently be re-loaded.
  182.  
  183. To delete a macro from a macro file:
  184.  
  185. * Delete the macro from the list of loaded macros, as
  186. described above.
  187.  
  188. * Click on [Save]. This saves the currently loaded macros
  189. to the file.
  190.  
  191. 7.5. Saving and loading macro files
  192.  
  193. To save the currently loaded macros to a file:
  194.  
  195. * Choose Macros... from the Tools menu. This displays
  196. a dialog box with a list of currently loaded macros.
  197. The name of the current macro file (if there is one)
  198. is displayed at the bottom of the dialog box.
  199.  
  200. * Click on [Save] to save the macros to the current
  201. macro file.
  202.  
  203. * Click on [Save As...] to save the macros to another
  204. macro file.
  205.  
  206.  A macro file saved in this way can later be loaded
  207. by clicking on Load.... 
  208.  
  209. If any macros are still unsaved when you attempt to
  210. exit HoTMetaL PRO, you will get a warning message informing
  211. you of this and giving you the opportunity to save the
  212. macros before exiting. 
  213.  
  214. To load a macro file:
  215.  
  216. * Choose Macros... from the Tools menu. 
  217.  
  218. * Click on [Load...].
  219.  
  220. * Choose a macro (.mcr) file. 
  221.  
  222. After a macro file is loaded, the previously loaded
  223. macros are unavailable. If any macros have been defined
  224. but not yet saved, these will be lost. Before the new
  225. macro file is loaded, you will receive a warning dialog
  226. giving you the opportunity to save any unsaved macros.
  227.  
  228.  
  229. When you load a macro file, it becomes the default macro
  230. file and will be loaded the next time you launch HoTMetaL
  231. PRO.  The default macro file for HoTMetaL PRO is hmpro4.mcr,
  232. located in the macros folder under the HoTMetaL PRO
  233. folder. See the file readme.htm in this folder for more
  234. information.
  235.  
  236.